package com.jml.servlet.web.impl;

import com.jml.servlet.DispatcherServlet;
import com.jml.servlet.web.WebApplicationInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;


public class AbstractDispatcherServletInitializer implements WebApplicationInitializer {
    
    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        // 1.开始注册我们的DispatcherServlet
        ServletRegistration.Dynamic dispatcherServlet = servletContext.addServlet("dispatcherServlet", new DispatcherServlet());
        dispatcherServlet.addMapping("/");// 拦截所有的请求
        dispatcherServlet.setLoadOnStartup(1);
    }
}
